import React from "react";
import screenfull from "screenfull";

const Top = (props) => {
  const fullScreenHandle = () => {
    if (screenfull.isEnabled){
      console.log('isFullscreen',screenfull.isFullscreen)
      //  screenfull.isFullscreen返回一个布尔值，当前是否是全屏状态
      //  screenfull.isEnabled  返回一个布尔值，是否当前可以进入全屏
      if (screenfull.isFullscreen) return
      screenfull.toggle()
    }else{
      console.log('浏览器不支持');
      
    }
  };

  return (
    <div className="top">
      <div className='full-screen' style={{ backgroundColor: 'pink' }} 
      onDoubleClick={fullScreenHandle}>1111122</div>
    </div>
  );
};

export default Top;